package pers.xukai.common.config.autoConfig.minio;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
/**
 * @author 殷绪凯
 * @datetime 2022年 10月 14日 16:49
 */
@Configuration
@EnableConfigurationProperties(MinioProp.class)
public class MinioTemplate {

    @Autowired
    private MinioProp minioProp;

    @Bean
    public MinioClient minioClientFactory()  {
        return MinioClient.builder()
                .endpoint(minioProp.getEndpoint())
                .credentials(minioProp.getAccessKey(), minioProp.getSecretKey())
                .build();
    }

}
